package com.stefanie.study.bp;

/**
 * @author: stefanie-zy
 * @time: 2024/7/1-16:59
 * @description: 建造者模式-指挥者
 */
public class Director {

    private Builder builder;


    public Director(Builder builder) {
        this.builder = builder;
    }

    public void setBuilder(Builder builder) {
        this.builder = builder;
    }

    // 产品构建方法和组装
    public Product construct() {
        builder.buildPartA(builder.getProduct());
        builder.buildPartB(builder.getProduct());
        builder.buildPartC(builder.getProduct());
        builder.buildPartD(builder.getProduct());
        return builder.getProduct();
    }
}
